package com.作业.第八章作业.HomeWork08;

public class SavingAccount extends BankAccount{
    private double interest = 0.01;
    private int count = 3;

    public SavingAccount(double balance) {
        super(balance);
    }
    public void deposit(double amount) {
        if(count > 0){
        super.deposit(amount);
        count--;
        }
        else{
            super.deposit(amount-1);
        }

    }

    public void withdraw(double amount) {
        if(count > 0){
            super.withdraw(amount);
            count--;
        }
        else{
            super.withdraw(amount+1);
        }
    }

    public void earnMonthInterest() {
        count = 3;
        super.deposit(getBalance()*interest);
    }
}
